package com.gxa.controller;

import com.gxa.pojo.Das;
import com.gxa.utils.Constants;
import com.gxa.utils.ResponseData;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * Created with IntelliJ IDEA.
 * User: tx
 * Date: 2020/11/26 16:01
 * Description:
 * Version: V1.0
 */
@RestController
@Api(value = "配送区域设置",tags = "配送区域设置")
@RequestMapping(value = "options")
public class DistributeAteaController {

    @Autowired
    private ResponseData responseData;
    @Autowired(required = false)
    private Constants constants;

    @PostMapping("/addDistributeAteaOptions")
    @ApiOperation(value = "添加配送区域",notes = "根据提交的信息添加配送方式",httpMethod = "POST",response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code = 200, message = "添加成功"),
            @ApiResponse(code = 400, message = "找不到页面"),
            @ApiResponse(code = 500, message = "添加失败")
    })
    public ResponseData addDistributeAteaOptions(@RequestBody @ApiParam(name = "das",value = "配送区域设置",required = true) Das das){
        responseData.setCode(Constants.SUCCESS);
        responseData.setMsg("添加成功");
        responseData.setData(das);
        return responseData;
    }



    @GetMapping("/delDistributeAteaOptions")
    @ApiOperation(value = "删除配送方式",notes = "根据提交的信息删除配送方式",httpMethod = "GET",response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code = 200, message = "删除成功"),
            @ApiResponse(code = 400, message = "找不到页面"),
            @ApiResponse(code = 500, message = "删除失败")
    })
    public ResponseData delDistributeAteaOptions(@ApiParam(name = "dasId",value = "配送区域设置",required = true) int dasId){
        responseData.setCode(Constants.SUCCESS);
        responseData.setMsg("删除成功");
        responseData.setData(dasId);
        return responseData;
    }




    @GetMapping("/updateDistributeAteaOptions")
    @ApiOperation(value = "修改配送方式",notes = "根据提交的信息修改配送方式",httpMethod = "GET",response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code = 200, message = "修改成功"),
            @ApiResponse(code = 400, message = "找不到页面"),
            @ApiResponse(code = 500, message = "修改失败")
    })
    public ResponseData updateDistributeAteaOptions(@ApiParam(name = "modId",value = "配送区域设置id",required = true) int dasId){
        responseData.setCode(Constants.SUCCESS);
        responseData.setMsg("修改成功");
        responseData.setData(dasId);
        return responseData;
    }



    @PostMapping("/queryDistributeAteaOptions")
    @ApiOperation(value = "查询配送方式",notes = "根据提交的信息查询配送方式",httpMethod = "POST",response = ResponseData.class)
    @ApiResponses({
            @ApiResponse(code = 200, message = "查询成功"),
            @ApiResponse(code = 400, message = "找不到页面"),
            @ApiResponse(code = 500, message = "查询失败")
    })
    public ResponseData queryDistributeAteaOptions(@ApiParam(name = "modSet",value = "配送区域设置",required = true) Das das){
        das.setDasCcm(1);
        das.setDasFc(23.44);
        das.setDasRc(23.00);
        das.getJda().setJdaCountry("中国");
        das.getJda().setJdaProvince("四川省");
        das.getJda().setJdaCity("成都");
        responseData.setCode(Constants.SUCCESS);
        responseData.setMsg("查询成功");
        responseData.setData(das);
        return responseData;
    }
}
